<?php
  $user=$_POST['user'];
require('sql.php');
    $json='';
    $data=array();
class user
{
	public $id;
	public $src;
	public $href;
	public $style;
	public $num;
}
$sql="SELECT * FROM shoucang WHERE cookie='$user'";
$result=mysqli_query($conn,$sql);
   while($row=mysqli_fetch_array($result))
     {
       	  $user=new user();
       	  $user->id=$row['id'];
       	  $user->src=$row['src'];
       	  $user->href=$row['href'];
       	  $user->style=$row['style'];
       	    $user->num=$row['num'];
       	  $data[]=$user;
     }
      $json=json_encode($data);//把数据转换为json数据
     echo $json;
?>